package com.myjavalab.core;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateFormatTest {

	public static void main(String[] args){
		Date d = new Date(112,10,24,20, 28, 45);
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		System.out.println(sdf.format(d));
		
		SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		System.out.println(sdf1.format(d));
		
		System.out.println(new Date(d.getTime()+ 24*60*60*1000));
		
		DateFormat df = SimpleDateFormat.getDateInstance();
		System.out.println(df.format(d));
		
		DateFormat df1 = SimpleDateFormat.getDateInstance(1);
		System.out.println(df1.format(d));
		
		DateFormat df2 = SimpleDateFormat.getDateInstance(2);
		System.out.println(df2.format(d));
		
		DateFormat df3 = SimpleDateFormat.getDateInstance(3);
		System.out.println(df3.format(d));
		
		DateFormat dtf = SimpleDateFormat.getDateTimeInstance();
		System.out.println(dtf.format(d));
		
		DateFormat dtf1 = SimpleDateFormat.getDateTimeInstance(1,1);
		System.out.println(dtf1.format(d));
		
		DateFormat dtf2 = SimpleDateFormat.getDateTimeInstance(1,2);
		System.out.println(dtf2.format(d));
		
		DateFormat dtf3 = SimpleDateFormat.getDateTimeInstance(1,3);
		System.out.println(dtf3.format(d));
	}
}
